package de.dhbw.ka.tit09.picsim.ui.model;

import de.dhbw.ka.tit09.picsim.model.AbstractModelObject;

/**
 * The model for a source text table element which is represented in the GUI as
 * a row in the source text table.
 * 
 * @author Andreas Bender
 * 
 */
public class SourceTextTableElement extends AbstractModelObject {
	private String text;
	private boolean command;
	private boolean checked;
	private boolean highlighted;

	/**
	 * Constructor.
	 * 
	 * @param text the displayed text in the GUI
	 * @param isCommand true if text contains an instruction
	 */
	public SourceTextTableElement(String text, boolean isCommand) {
		this.text = text;
		this.command = isCommand;
	}

	/**
	 * Returns the source text value.
	 * 
	 * @return the source text
	 */
	public String getText() {
		return text;
	}

	/**
	 * Sets the source text value.
	 * 
	 * @param text the source text
	 */
	public void setText(String text) {
		firePropertyChange("text", this.text, this.text = text);
	}

	/**
	 * Returns the command value;
	 * 
	 * @return true if text contains an instruction
	 */
	public boolean isCommand() {
		return command;
	}

	/**
	 * Sets the command value.
	 * 
	 * @param isCommand true if text contains an instruction
	 */
	public void setCommand(boolean isCommand) {
		firePropertyChange("command", this.command, this.command = isCommand);
	}

	/**
	 * Sets the is checked flag.
	 * 
	 * @param checked true if breakpoint is checked
	 */
	public void setChecked(boolean checked) {
		firePropertyChange("checked", this.checked, this.checked = checked);
	}

	/**
	 * Returns the value of the is checked flag.
	 * 
	 * @return true if breakpoint is checked
	 */
	public boolean isChecked() {
		return checked;
	}

	/**
	 * Sets the highlighting state of the element
	 * 
	 * @param highlighted true if element is highlighted
	 */
	public void setHighlighted(boolean highlighted) {
		firePropertyChange("highlighted", this.highlighted,
				this.highlighted = highlighted);
	}

	/**
	 * Returns the highlighting state.
	 * 
	 * @return true if element should be highlighted
	 */
	public boolean isHighlighted() {
		return highlighted;
	}
}
